home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / doors / acnt / acnt.c next >
Encoding:
C/C++ Source or Header  |  1992-12-26  |  13.0 KB  |  481 lines

  1. #include <exec/types.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include "source:aztec/glue.h"
  6. #define FOREVER while(1)
  7. #define KEYBOARD_TIMEOUT 0
  8. #define SUCCESS 1
  9. #define FAILURE 0
  10. #define sm sendmessage
  11. int Edit_Accounts(void);
  12.  
  13. int GI2;
  14. struct User {
  15.  char    Name[31],Pass[9],Location[30],PhoneNumber[13];
  16.  USHORT  Slot_Number;
  17.  USHORT  Sec_Status,
  18.      Sec_Board,                   /* File or Byte Ratio */
  19.      Sec_Library,                 /* Ratio              */
  20.      Sec_Bulletin,                /* Computer Type      */
  21.      Messages_Posted;
  22.  /* Note ConfYM = the last msg you actually read, ConfRead is the same ?? */
  23.  ULONG   NewSinceDate, ConfRead1, ConfRead2, ConfRead3, ConfRead4,
  24.          ConfRead5;
  25.  UWORD   XferProtocol, Filler2;
  26.  UWORD   Lcfiles,BadFiles; 
  27.  ULONG   AccountDate;
  28.  UWORD   ScreenType, Filler1;
  29.  char    Conference_Access[10];
  30.  USHORT  Uploads, Downloads, ConfRJoin, Times_Called;
  31.  long    Time_Last_On, Time_Used, Time_Limit, Time_Total;
  32.  ULONG   Bytes_Download, Bytes_Upload, Daily_Bytes_Limit, Daily_Bytes_Dld;
  33.  char    Expert;
  34.  ULONG   ConfYM1, ConfYM2, ConfYM3, ConfYM4, ConfYM5, ConfYM6, ConfYM7,
  35.          ConfYM8, ConfYM9;
  36.  long    BeginLogCall;
  37.  UBYTE   Protocol, UUCPA, LineLength, New_User;
  38.  };
  39. UBYTE GSTR3[3000],GSTR2[3000],GSTR1[3000];
  40.  
  41.  
  42. main(int argc,char *argv[])
  43. {
  44.   if(argc!=2)
  45.   {
  46.     printf("ACNT version 1.0, written by Joseph Hodge\n");
  47.     printf("\n");
  48.     exit(0);
  49.   }
  50.   Register(argv[1][0]-'0');
  51.   Edit_Accounts();
  52.   ShutDown();
  53.   end();
  54. }
  55. struct User *hoozer;
  56. #define AEPutStr(x) sendmessage(x,0)
  57. #define LineInput(x,y,z,t) prompt(x,y,z)
  58. static UBYTE UUCPNumberInput(void)
  59. {
  60.  AEPutStr(" \b");
  61.  prompt("",GSTR1,1);
  62.  return((UBYTE)atol(GSTR1));
  63. }
  64.  
  65. static int NumberInput(void)
  66. {
  67.  AEPutStr("     \b\b\b\b\b");
  68.  prompt("",GSTR1,5);
  69.  return((int)atol(GSTR1));
  70. }
  71.  
  72. static ULONG LongNumberInput(void)
  73. {
  74.  AEPutStr("          \b\b\b\b\b\b\b\b\b\b");
  75.  LineInput("",GSTR1,10,KEYBOARD_TIMEOUT);
  76.  return((ULONG)atol(GSTR1));
  77. }
  78.  
  79. static void Display_Account(int who)
  80. {
  81.  if(hoozer->Slot_Number!=0)    {
  82.         sprintf(GSTR1,"H  ACTIVE [%hu]   \r\n",hoozer->Slot_Number);
  83.         AEPutStr(GSTR1);
  84.  
  85.     } else {
  86.      sprintf(GSTR1,"HINACTIVE [%hu]     \r\n",who);
  87.         AEPutStr(GSTR1);
  88.     }
  89.  
  90.  sprintf(GSTR1,"HA> Name: %-32s ",hoozer->Name);
  91.  AEPutStr(GSTR1);
  92.  sprintf(GSTR1,"2HB> Loc.: %-29s\r\n",hoozer->Location);
  93.  AEPutStr(GSTR1);
  94. sprintf(GSTR1,"C> Pass ..........: %-8s\r\n",hoozer->Pass);
  95.  AEPutStr(GSTR1);
  96.  
  97.  
  98.  sprintf(GSTR1,"D> Phone Number ..: %-13s",hoozer->PhoneNumber);
  99.  AEPutStr(GSTR1);
  100.  
  101.  sprintf(GSTR1,"HE> Ratio .........: %-7hu\r\n",hoozer->Sec_Library);
  102.  AEPutStr(GSTR1);
  103.  sprintf(GSTR1,"6HF> Area Name......: %s",hoozer->Conference_Access);
  104.  AEPutStr(GSTR1);
  105.  
  106.  sprintf(GSTR1,"HG> Ratio Type ....: %-5hu",hoozer->Sec_Board);
  107.  AEPutStr(GSTR1);
  108.  if(hoozer->Sec_Board==0) AEPutStr(" <-Byte)");
  109.  if(hoozer->Sec_Board==1) AEPutStr(" <-B/F) ");
  110.  if(hoozer->Sec_Board==2) AEPutStr(" <-File)");
  111.  
  112.  sprintf(GSTR1,"6HH> Sec_Level .....: %-5hu",hoozer->Sec_Status);
  113.  AEPutStr(GSTR1);
  114.  
  115.  sprintf(GSTR1,"HI> Uploads .......: %-10hu\r\n",hoozer->Uploads);
  116.  AEPutStr(GSTR1);
  117.  sprintf(GSTR1,"6HJ> AutoReJoin ....: %-10hu",hoozer->ConfRJoin);
  118.  AEPutStr(GSTR1);
  119.  
  120.  sprintf(GSTR1,"HK> Downloads .....: %-10hu\r\n",hoozer->Downloads);
  121.  AEPutStr(GSTR1);
  122.  
  123.  sprintf(GSTR1,"6HL> Messages_Posted: %-7hu",hoozer->Messages_Posted);
  124.  AEPutStr(GSTR1);
  125.  sprintf(GSTR1,"HM> Bytes Uled ....: %-10ld\r\n",hoozer->Bytes_Upload);
  126.  AEPutStr(GSTR1);
  127.  
  128.  sprintf(GSTR1,"6HN> New_User ......: %s #Calls%-12ld",(hoozer->New_User?"Yes":"No "),hoozer->Times_Called);
  129.  AEPutStr(GSTR1);
  130.  sprintf(GSTR1,"1HO> Bytes Dled ....: %-10ld\r\n",hoozer->Bytes_Download);
  131.  AEPutStr(GSTR1);
  132.  
  133.  sprintf(GSTR2,"%s",ctime(&hoozer->Time_Last_On));
  134.  GSTR2[24]='\0';
  135.  sprintf(GSTR1,"9HLast Called ...: %s",GSTR2);
  136.  AEPutStr(GSTR1);
  137.  sprintf(GSTR1,"1HQ> Byte Limit ....: %-10ld\r\n",hoozer->Daily_Bytes_Limit);
  138.  AEPutStr(GSTR1);
  139.  
  140.  sprintf(GSTR1,"39HComputer Type .: ");
  141.  AEPutStr(GSTR1);
  142.       AEPutStr("39HScreen Type  ..: ");
  143.  //sprintf(GSTR1,"%sScreenTypes.DEF",Cmds->BBSLoc);
  144.   sprintf(GSTR2,"TITLE.%d",hoozer->ScreenType+1);
  145.   AEPutStr("56H");
  146.   /*if(GetFromIconStr(GSTR1,GSTR2,GSTR2))
  147.   {
  148.     sprintf(GSTR1,"%-16s",GSTR2);
  149.     AEPutStr(GSTR1);
  150.   }*/
  151. //(RTS)
  152.  
  153.  sprintf(GSTR1,"1HR> Time_Limit: [%-8lu] secs    ",hoozer->Time_Limit);
  154.  AEPutStr(GSTR1);
  155.  sprintf(GSTR1," S> Time_Used: [%-8lu] secs  T> UUCP%d\r\n",hoozer->Time_Used,hoozer->UUCPA);
  156.  AEPutStr(GSTR1);
  157.  AEPutStr("\r\n");
  158.  
  159.  AEPutStr("X=EXIT-NOSAVE TAB=Cont  ~=SAVE  1-6=Presets  9=RE-ACTIVATE  DEL=DELETE\r\n");
  160. }
  161.  
  162. static void Display_Account_Info(int who)
  163. {
  164.  if(hoozer->Slot_Number!=0)    {
  165.         sprintf(GSTR1,"H  ACTIVE [%hu]   \r\n",hoozer->Slot_Number);
  166.         AEPutStr(GSTR1);
  167.     } else {
  168.      sprintf(GSTR1,"HINACTIVE [%hu]     \r\n",who);
  169.         AEPutStr(GSTR1);
  170.     }
  171.  
  172.  sprintf(GSTR1,"0H%-32s",hoozer->Name);
  173.  AEPutStr(GSTR1);
  174.  sprintf(GSTR1,"1H%-29s",hoozer->Location);
  175.  AEPutStr(GSTR1);
  176. sprintf(GSTR1,"1H%-8s",hoozer->Pass);
  177. AEPutStr(GSTR1);
  178.  
  179.  sprintf(GSTR1,"1H%-13s",hoozer->PhoneNumber);
  180.  AEPutStr(GSTR1);
  181.  
  182.  sprintf(GSTR1,"1H%-7hu",hoozer->Sec_Library);
  183.  AEPutStr(GSTR1);
  184.  
  185.  sprintf(GSTR1,"6H%-10s",hoozer->Conference_Access);
  186.  AEPutStr(GSTR1);
  187.  
  188.  sprintf(GSTR1,"1H%-5hu",hoozer->Sec_Board);
  189.  AEPutStr(GSTR1); 
  190.   if(hoozer->Sec_Board==0) AEPutStr(" <-Byte)");
  191.  if(hoozer->Sec_Board==1) AEPutStr(" <-B/F) ");
  192.  if(hoozer->Sec_Board==2) AEPutStr(" <-File)");
  193.  
  194.  sprintf(GSTR1,"6H%-5hu",hoozer->Sec_Status);
  195.  AEPutStr(GSTR1);
  196.  
  197.  sprintf(GSTR1,"1H%-10hu",hoozer->Uploads);
  198.  AEPutStr(GSTR1);
  199.  sprintf(GSTR1,"6H%-7hu",hoozer->ConfRJoin);
  200.  AEPutStr(GSTR1);
  201.  
  202.  sprintf(GSTR1,"1H%-10hu",hoozer->Downloads);
  203.  AEPutStr(GSTR1);
  204.  
  205.  sprintf(GSTR1,"6H%-7hu",hoozer->Messages_Posted);
  206.  AEPutStr(GSTR1);
  207.  sprintf(GSTR1,"1H%-10ld",hoozer->Bytes_Upload);
  208.  AEPutStr(GSTR1);
  209.  
  210.  sprintf(GSTR1,"6H%s #Calls%-12ld",(hoozer->New_User?"Yes":"No "),hoozer->Times_Called);
  211.  AEPutStr(GSTR1);
  212.  sprintf(GSTR1,"21H%-10ld",hoozer->Bytes_Download);
  213.  AEPutStr(GSTR1);
  214.  
  215.  sprintf(GSTR2,"%s",ctime(&hoozer->Time_Last_On));
  216.  GSTR2[24]='\0';
  217.  sprintf(GSTR1,"6H%s",GSTR2);
  218.  AEPutStr(GSTR1);
  219.  sprintf(GSTR1,"21H%-10ld",hoozer->Daily_Bytes_Limit);
  220.  AEPutStr(GSTR1);
  221.  
  222.   //sprintf(GSTR1,"%sScreenTypes.DEF",Cmds->BBSLoc);
  223.   sprintf(GSTR2,"TITLE.%d",hoozer->ScreenType+1);
  224.   AEPutStr("56H");
  225.   /*if(GetFromIconStr(GSTR1,GSTR2,GSTR2))
  226.   {
  227.     sprintf(GSTR1,"%-16s",GSTR2);
  228.     AEPutStr(GSTR1);
  229.   }*/
  230.  
  231. //(RTS)
  232.  
  233.  sprintf(GSTR1,"17H%-6lu",hoozer->Time_Limit);
  234.  AEPutStr(GSTR1);
  235.  sprintf(GSTR1,"51H%-6lu",hoozer->Time_Used);
  236.  AEPutStr(GSTR1);
  237.  
  238.  sprintf(GSTR1,"76H%d",hoozer->UUCPA);
  239.  AEPutStr(GSTR1);
  240.  
  241. }
  242.  
  243.  
  244. UWORD EditInfo(int which)
  245. {
  246. int flag; 
  247. int command;
  248. char temp[100];
  249.  //NOFKeys=1;
  250.  Display_Account(which);
  251.  strcpy(GSTR1,hoozer->Name);
  252.  (void)strupr(GSTR1);
  253.  
  254.     FOREVER    {
  255.         flag=0;
  256.         hotkey("",temp); command=temp[0];
  257.         switch(command)    {
  258.             case 'X':                       /* NO-SAVE */
  259.                 AEPutStr("No-Save\r\n");
  260.                 flag=1;
  261.                 break;
  262.             case '\t':
  263.                 flag=2;
  264.                 break;
  265.             case '\177':                    /* DELETE */
  266.                 AEPutStr("Delete\r\n");
  267.                 GI2=which;
  268.                 hoozer->Slot_Number=0;
  269.  
  270.              /* changed from ForceSave_Account Thu Jan 30 04:17:48 1992 */
  271.                 Save_Account(GI2);
  272.                     //DeleteConfAccess(hoozer->Slot_Number);
  273.                 Display_Account_Info(which); 
  274.                 flag=0;
  275.                 break;
  276.             case ' ':
  277.                 Display_Account_Info(which);
  278.                 break;
  279.             case '+':
  280.                     which=which+1;
  281.                     if((hoozer=Load_Account(which))!=NULL)
  282.                         Display_Account_Info(which);
  283.                     else {
  284.                         which=1;
  285.                         hoozer=Load_Account(which);
  286.                         Display_Account_Info(which);
  287.                     }
  288.                 break;
  289.             case '-':
  290.                     which=which-1;
  291.                          if(which<1) which=1;
  292.                     hoozer=Load_Account(which);
  293.                     Display_Account_Info(which);
  294.                 break;
  295.             case '~': /* SAVE */
  296.                 AEPutStr("Save\r\n");
  297.                     hoozer->New_User=0;
  298.                     Display_Account_Info(which);
  299.                     Save_Account(which);  /* 1 = FORCE SAVE */
  300.                 break;
  301.                case '8': case '7':
  302.             case '6': case '5': case '4': case '3':
  303.             case '2': /* VALIDATE */
  304.             case '1':
  305.                 break;
  306.              
  307.             case '9':                       /* RE-ACTIVATE */
  308.                 AEPutStr("Re-Activate\r\n");
  309.                 hoozer->Slot_Number=which;
  310.                 flag=0;
  311.                 break;
  312.             case 'a': case 'A':             /* NAME */
  313.                 AEPutStr("0H");
  314.                 LineInput(hoozer->Name,hoozer->Name,30,KEYBOARD_TIMEOUT);
  315.                 strcpy(GSTR1,hoozer->Name);
  316.                 (void)strupr(GSTR1);
  317.                 flag=0;
  318.                 break;
  319.             case 'b': case 'B':             /* Location */
  320.                 AEPutStr("1H");
  321.                 LineInput(hoozer->Location,
  322.                     hoozer->Location,29,KEYBOARD_TIMEOUT);
  323.                 flag=0;
  324.                 break;
  325.             case 'c': case 'C': /* PASS */
  326.                         AEPutStr("1H");
  327.                     LineInput(hoozer->Pass,hoozer->Pass,8,KEYBOARD_TIMEOUT);
  328.                 flag=0;
  329.                 break;
  330.             case 'd': case 'D': /* Phone number */
  331.                 AEPutStr("1H");
  332.                 LineInput(hoozer->PhoneNumber,
  333.                     hoozer->PhoneNumber,12,KEYBOARD_TIMEOUT);
  334.                 flag=0;
  335.                 break;
  336.             case 'e': case 'E': /* RATIO */
  337.                 AEPutStr("1H");
  338.                 hoozer->Sec_Library=NumberInput();
  339.                 flag=0;
  340.                 break;
  341.             case 'f': case 'F': /* conference access */
  342.                 AEPutStr("6H");
  343.                 LineInput(hoozer->Conference_Access,hoozer->Conference_Access,9,KEYBOARD_TIMEOUT);
  344.                     flag=0;
  345.                 break;
  346.             case 'g': case 'G':  /* Ratio Type */
  347.                 AEPutStr("1H");
  348.                 hoozer->Sec_Board=NumberInput();
  349.                     if(hoozer->Sec_Board<0 || hoozer->Sec_Board > 2) 
  350.                     {
  351.                       AEPutStr("\a"); hoozer->Sec_Board=0; }
  352.  sprintf(GSTR1,"HG> Ratio Type ....: %-5hu",hoozer->Sec_Board);
  353.  AEPutStr(GSTR1);
  354.  if(hoozer->Sec_Board==0) AEPutStr(" <-Byte)");
  355.  if(hoozer->Sec_Board==1) AEPutStr(" <-B/F) ");
  356.  if(hoozer->Sec_Board==2) AEPutStr(" <-File)");
  357.  
  358.                 flag=0;
  359.                 break;
  360.             case 'h': case 'H': /* SEC_Level */
  361.   
  362.                     AEPutStr("6H");
  363.                     hoozer->Sec_Status=NumberInput();
  364.                 flag=0;
  365.                 break;
  366.             case 'i': case 'I':                 /* UPLOADS */
  367.                 AEPutStr("1H");
  368.                 hoozer->Uploads=NumberInput();
  369.                 flag=0;
  370.                 break;
  371.             case 'j': case 'J':                 /* conference ReJoin */
  372.                 AEPutStr("6H");
  373.                 hoozer->ConfRJoin=NumberInput();
  374.              flag=0;
  375.                 break;
  376.             case 'k': case 'K': /* DOWNLOADS */
  377.                 AEPutStr("1H");
  378.                 hoozer->Downloads=NumberInput();
  379.                 flag=0;
  380.                 break;
  381.             case 'l': case 'L': /* MESSAGES_POSTED */
  382.                 AEPutStr("6H");
  383.                 hoozer->Messages_Posted=NumberInput();
  384.                 flag=0;
  385.                 break;
  386.             case 'm': case 'M': /* Bytes Uploaded */
  387.                 AEPutStr("1H");
  388.                 hoozer->Bytes_Upload=LongNumberInput();
  389.                 flag=0;
  390.                 break;
  391.                case '#':
  392.                     AEPutStr("8H");
  393.                     hoozer->Times_Called=LongNumberInput();
  394.                     flag=0;
  395.                     break;
  396.             case 'o': case 'O': /* Bytes Downloaded */
  397.                 AEPutStr("21H");
  398.                 hoozer->Bytes_Download=LongNumberInput();
  399.                 flag=0;
  400.                 break;
  401.             case 'q': case 'Q': /* Daily Bytes Limit */
  402.                 AEPutStr("21H");
  403.                 hoozer->Daily_Bytes_Limit=LongNumberInput();
  404.                 flag=0;
  405.                 break;
  406.             case 'r': case 'R': /* Time_Limit */
  407.                 AEPutStr("17H");
  408.                 hoozer->Time_Limit=LongNumberInput();
  409.                 if(hoozer->Time_Total<hoozer->Time_Limit)
  410.                       hoozer->Time_Total=hoozer->Time_Limit;
  411.                 flag=0;
  412.                 break;
  413.             case 's': case 'S': /* TIME_USED */
  414.  
  415.                 AEPutStr("51H");
  416.                 hoozer->Time_Used=LongNumberInput();
  417.                 flag=0;
  418.                 break;
  419.             case 't':        case 'T':
  420.                 AEPutStr("76H");
  421.                 hoozer->UUCPA=UUCPNumberInput();
  422.                 flag=0;
  423.                 break;
  424.  
  425.             default:
  426.                 flag=0;
  427.                 break;
  428.             }
  429.         AEPutStr("1H");
  430.         if(flag) { break; }
  431.         }
  432. //NOFKeys=0;
  433. return((UWORD)flag);
  434. }
  435.  
  436. WORD CheckNEdit(WORD which)
  437. {
  438. WORD stat;
  439.  
  440. AEPutStr("\014");
  441. hoozer=Load_Account(which);
  442. if(hoozer==NULL)
  443.     {
  444.     AEPutStr("Warning, error while loading account\r\n");
  445.     return(FAILURE);
  446.     }
  447. AEPutStr("\017\014");
  448. stat=EditInfo(which);
  449. return(stat);
  450. }
  451.  
  452. int Edit_Accounts(void)
  453. {
  454. WORD stat;
  455. int which;
  456.  
  457.  FOREVER    {
  458.         AEPutStr("\r\nEnter Account Number ? ");
  459.         LineInput("",GSTR3,5,KEYBOARD_TIMEOUT);
  460.         if(GSTR3[0]=='\0') { goto RETURNF; }
  461.  
  462.  
  463.         which=(int)atol(GSTR3);
  464.         if(which<=0)  goto RETURNF;
  465.         CheckNEdit(which);
  466.     }
  467.  RETURNF:
  468.  AEPutStr("\r\n");
  469.  return(SUCCESS);
  470. }
  471.  
  472. void LastCommand(void)
  473. {
  474.   sm("",1);
  475.   sm("",1);
  476. }
  477.  
  478. void end(void)
  479. {
  480.   exit(0);
  481. }